package com.xtourms.client.rm.ticket;

import com.google.gwt.core.client.GWT;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.xtourms.shared.field.TicketField;

public class TicketDetail extends DialogBox {

	private static TicketDetailUiBinder uiBinder = GWT
			.create(TicketDetailUiBinder.class);

	interface TicketDetailUiBinder extends UiBinder<Widget, TicketDetail> {
	}

	public TicketDetail(JSONObject ticketObj) {
		setWidget(uiBinder.createAndBindUi(this));
		setAnimationEnabled(true);
		setAutoHideEnabled(true);
		init(ticketObj);
	}

	@UiField Label province;
	@UiField Label city;
	@UiField Label ticket_add;
	@UiField Label ticket_des;
	
	@UiField Label manager_name;
	@UiField Label manager_mobile;
	@UiField Label linkman_name;
	@UiField Label linkman_mobile;
	@UiField Label linkman_qq;
		
	@UiField Label symbiosis;
	@UiField Label start_date;
	@UiField Label end_date;
	
	private void init(JSONObject ticketObj) {
		setText(((JSONString)ticketObj.get(TicketField.TICKET_NAME)).stringValue());
		province.setText(((JSONString)ticketObj.get(TicketField.TICKET_PROVINCE_NAME)).stringValue());
		city.setText(((JSONString)ticketObj.get(TicketField.TICKET_CITY_NAME)).stringValue());
		ticket_add.setText(((JSONString)ticketObj.get(TicketField.TICKET_ADD)).stringValue());
		ticket_des.setText(((JSONString)ticketObj.get(TicketField.TICKET_DES)).stringValue());

		manager_name.setText(((JSONString)ticketObj.get(TicketField.TICKET_MANAGER_NAME)).stringValue());
		manager_mobile.setText(((JSONString)ticketObj.get(TicketField.TICKET_MANAGER_MOBILE)).stringValue());
		linkman_name.setText(((JSONString)ticketObj.get(TicketField.TICKET_LINKMAN_NAME)).stringValue());
		linkman_mobile.setText(((JSONString)ticketObj.get(TicketField.TICKET_LINKMAN_MOBILE)).stringValue());
		linkman_qq.setText(((JSONString)ticketObj.get(TicketField.TICKET_LINKMAN_QQ)).stringValue());
		
		symbiosis.setText(((JSONString)ticketObj.get(TicketField.TICKET_SYMBIOSIS)).stringValue());
		start_date.setText(((JSONString)ticketObj.get(TicketField.TICKET_START_DATE)).stringValue());
		end_date.setText(((JSONString)ticketObj.get(TicketField.TICKET_END_DATE)).stringValue());
	}

}
